﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Raw1
{


    public interface INotifier
    {
        Notifiers NotificationType { get; set; }
        void Subscribe(INotifier notifier);
        void Uubscribe(INotifier notifier);
        void Start();
        void Stop();
        void Notify();
    }

    public abstract class NotificationMonitor
    {
        private List<INotifier> notifierList;

        public NotificationMonitor()
        {
            notifierList = new List<INotifier>();
        }


        public void Subscribe(INotifier notifier)
        {
            if (notifierList.Any(m => m.NotificationType == notifier.NotificationType))
            {
                //Already there
            }
            else
            {
                notifierList.Add(notifier);
            }
        }

        public void Unsubscribe(INotifier notifier)
        {
            if (notifierList.Any(n => n.NotificationType == notifier.NotificationType))
            {
                //not in list
            }
            else
            {
                notifierList.Remove(notifier);
            }
        }
        public void Start() { }
        public void Stop() { }

        public void Notify() { }

    }
}
